package jtk.project4.fleet.field;

import java.awt.FlowLayout;
import java.text.SimpleDateFormat;
import nl.coderight.jazz.form.FormLayout;
import nl.coderight.jazz.form.FormLayout.Resize;
import nl.coderight.jazz.form.control.CalendarControl;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.button.CheckButton;


public class ViewSettingsField extends GroupControl{//<CostStatistic>{
	private CheckButton viewSettingsCheckButton;
	private CalendarControl currentDateField ;
	private CalendarControl endDateField ;
	
	public ViewSettingsField(String bindID){
		setTitle("View Settings");
		setBindID(bindID);
		createFields();
		createLayout();
	}
	
	private void createLayout() {
		// TODO Auto-generated method stub
		setLayout(new FormLayout())
		.addField(viewSettingsCheckButton)
		.addLabel(" ")						.addField(currentDateField, Resize.HORIZONTAL)
		.addLabel("through")				.addField(endDateField, Resize.HORIZONTAL);
			
	}

	private void createFields() {
		// TODO Auto-generated method stub
		viewSettingsCheckButton = new CheckButton("Enable date interval viewing");
		
		currentDateField = new CalendarControl(" ", 20);
		currentDateField.setFormat(new SimpleDateFormat());
		currentDateField.showYearSpinner(true);
		currentDateField.setPreferredSize(getPreferredSize());
		
		endDateField = new CalendarControl(" ", 20);
		endDateField.setFormat(new SimpleDateFormat());
		endDateField.showYearSpinner(true);
		endDateField.setPreferredSize(getPreferredSize());
		
	}
}